package JDBC;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class JDBCDemo9 {
    public static void main(String[] args) throws SQLException {
        Connection conn = DBUtil.getConnection();
        String sql = "INSERT INTO userinfo(username,password,nickname,age) "+
                     "VALUES(?,?,?,?);";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1,"刘国斌");
        ps.setString(2,"123123");
        ps.setString(3,"国斌");
        ps.setString(4,"40");
        int sum = ps.executeUpdate();
        if (sum>0){
            System.out.println("插入成功");
        }
    }
}
